home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / lib / rhythmbox / plugins / magnatune / BuyAlbumHandler.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2009-04-20  |  1.9 KB  |  45 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. import xml.sax as xml
  5. import xml.sax.handler as xml
  6.  
  7. class BuyAlbumHandler(xml.sax.handler.ContentHandler):
  8.     format_map = {
  9.         'ogg': 'URL_OGGZIP',
  10.         'flac': 'URL_FLACZIP',
  11.         'wav': 'URL_WAVZIP',
  12.         'mp3-cbr': 'URL_128KMP3ZIP',
  13.         'mp3-vbr': 'URL_VBRZIP' }
  14.     
  15.     def __init__(self, format):
  16.         xml.sax.handler.ContentHandler.__init__(self)
  17.         self._format_tag = self.format_map[format]
  18.  
  19.     
  20.     def startElement(self, name, attrs):
  21.         self._text = ''
  22.  
  23.     
  24.     def endElement(self, name):
  25.         if name == 'ERROR':
  26.             raise MagnatunePurchaseError(self._text)
  27.         name == 'ERROR'
  28.         if name == 'DL_USERNAME':
  29.             self.username = self._text
  30.         elif name == 'DL_PASSWORD':
  31.             self.password = self._text
  32.         elif name == self._format_tag:
  33.             self.url = self._text
  34.         
  35.  
  36.     
  37.     def characters(self, content):
  38.         self._text = self._text + content
  39.  
  40.  
  41.  
  42. class MagnatunePurchaseError(Exception):
  43.     pass
  44.  
  45.